<template id="app">
  <component :is="route.layout" />
</template>

<style></style>
<script setup>
import router from "@/router";
import store from "@/store";
import { reactive } from "vue";
import ACCESS_ENUM from "@/access/accessEnum";
import EmptyLayout from "@/layouts/EmptyLayout.vue";

const route = reactive({ layout: "div" });
// router.beforeEach((to, from, next) => {
//   // 仅管理员可见，判断当前用户是否有权限
//   if (to.meta?.access === ACCESS_ENUM.ADMIN) {
//     if (store.state.user.loginUser?.role !== ACCESS_ENUM.ADMIN) {
//       next("/noAuth");
//       return;
//     }
//   }
//   next();
// });
router.afterEach((to, from, failure) => {
  route.layout = to.meta?.layout ?? EmptyLayout;
});
</script>
